package biz.datalk.industrialland.admin.modules.system.pojo.dto;

import biz.datalk.industrialland.common.pojo.po.BasePO;
import biz.datalk.industrialland.common.validated.BatchDelete;
import biz.datalk.industrialland.common.validated.Delete;
import biz.datalk.industrialland.common.validated.Insert;
import biz.datalk.industrialland.common.validated.Update;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * @author tarofang@163.com
 * @date 2019-12-23
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class SysDictDTO extends BasePO implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * sys_dict.id
     */
    @EqualsAndHashCode.Include
    @NotNull(groups = {Update.class, Delete.class}, message = "{sysdict.no.exists.or.delete}")
    private Long id;

    /**
     * sys_dict.dict_id
     */
    private String dictId;

    /**
     * 字典名称
     * <p>
     * sys_dict.dict_name
     */
    @NotBlank(groups = {Insert.class, Update.class}, message = "{sysdict.blank.dictName}")
    private String dictName;

    /**
     * 字典编码
     * <p>
     * 大写字母、小写字母、数字、下换线组成且不能以下划线开头和结尾
     * <p>
     * sys_dict.dict_code
     */
    @Pattern(regexp = "^(?!_)(?!.*?_$)[a-zA-Z0-9_]+$", groups = {Update.class, Insert.class}, message = "{sysdict.invalid.dictCode}")
    @NotBlank(groups = {Insert.class, Update.class}, message = "{sysdict.blank.dictCode}")
    private String dictCode;

    /**
     * 描述
     * <p>
     * sys_dict.description
     */
    private String description;

    /**
     * 删除状态
     * <p>
     * sys_dict.is_valid
     */
    private String isValid;

    /**
     * 删除状态
     * <p>
     * sys_dict.is_delete
     */
    private String isDelete;

    @NotBlank(groups = BatchDelete.class, message = "{sysdict.no.exists.or.delete}")
    private String sysids;
}
